X
The image -downloader package can extract an image from a url. It's a simple package to implement. It is an object with 1 method on it that takes an options object. We're going to start by grabbing the url of the image. We're going to use the url module built into node. Then, we're going to make an object called options with two properties,
url - The url to get the image from.
dest - The path the file will be saved to, you can also change the name of the file at the end of the path.
Next, we're going to get the image-downloader object & run the method image with the options object as the parameter. This will return a promise with the a filename object as the data. Lastly, we're going to catch any errors we may receive.
You can find a link to the project here.